import StateEnum from "@/enums/StateEnum";

export class BaseModel {

    public static readonly stateMap: {label: string, value: number, type: 'success'|'danger'}[] = [
        {label: '启用', value: StateEnum.Active, type: 'success'},
        {label: '停用', value: StateEnum.InActive, type: "danger"}
    ]

    public static getStateLabel(state) {
        return BaseModel.stateMap.find(item => item.value === state)?.label
    }

    public static getStateType(state) {
        return BaseModel.stateMap.find(item => item.value === state)?.type
    }

    public deserialize?(input: any): this {
        Object.assign(this, input);
        return this;
    }
}